package com.david.dao;

import com.david.entity.Category;
import com.david.entity.Message;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MessageDao {
    @Select("select * from message where type = #{type} order by id desc")
    List<Message> findByType(int type);

    @Select("select count(*) from message where type = #{type} order by id desc")
    int findByTypeCount(int type);

    @Select("select * from message where id = #{id} ")
    Message findById(Integer id);

    @Insert("insert into message (name,tel,content,createTime,type) values (#{name},#{tel},#{content},#{createTime},#{type})")
    int insert(Message message);

}
